package com.chenchen.tiguan.venue.service.impl;

import java.util.List;
import com.chenchen.tiguan.common.utils.DateUtils;
import com.chenchen.tiguan.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chenchen.tiguan.venue.mapper.VenueReservationMapper;
import com.chenchen.tiguan.venue.domain.VenueReservation;
import com.chenchen.tiguan.venue.service.IVenueReservationService;

/**
 * 用户预约记录Service业务层处理
 * 
 * @author chenchen
 * @date 2025-04-14
 */
@Service
public class VenueReservationServiceImpl implements IVenueReservationService 
{
    @Autowired
    private VenueReservationMapper venueReservationMapper;

    /**
     * 查询用户预约记录
     * 
     * @param reservationId 用户预约记录主键
     * @return 用户预约记录
     */
    @Override
    public VenueReservation selectVenueReservationByReservationId(Long reservationId)
    {
        return venueReservationMapper.selectVenueReservationByReservationId(reservationId);
    }

    /**
     * 查询用户预约记录列表
     * 
     * @param venueReservation 用户预约记录
     * @return 用户预约记录
     */
    @Override
    public List<VenueReservation> selectVenueReservationList(VenueReservation venueReservation)
    {
        return venueReservationMapper.selectVenueReservationList(venueReservation);
    }

    /**
     * 新增用户预约记录
     * 
     * @param venueReservation 用户预约记录
     * @return 结果
     */
    @Override
    public int insertVenueReservation(VenueReservation venueReservation)
    {
        venueReservation.setCreateTime(DateUtils.getNowDate());
        venueReservation.setCreateBy(SecurityUtils.getUsername());
        return venueReservationMapper.insertVenueReservation(venueReservation);
    }

    /**
     * 修改用户预约记录
     * 
     * @param venueReservation 用户预约记录
     * @return 结果
     */
    @Override
    public int updateVenueReservation(VenueReservation venueReservation)
    {
        venueReservation.setUpdateTime(DateUtils.getNowDate());
        venueReservation.setUpdateBy(SecurityUtils.getUsername());
        return venueReservationMapper.updateVenueReservation(venueReservation);
    }

    /**
     * 批量删除用户预约记录
     * 
     * @param reservationIds 需要删除的用户预约记录主键
     * @return 结果
     */
    @Override
    public int deleteVenueReservationByReservationIds(Long[] reservationIds)
    {
        return venueReservationMapper.deleteVenueReservationByReservationIds(reservationIds);
    }

    /**
     * 删除用户预约记录信息
     * 
     * @param reservationId 用户预约记录主键
     * @return 结果
     */
    @Override
    public int deleteVenueReservationByReservationId(Long reservationId)
    {
        return venueReservationMapper.deleteVenueReservationByReservationId(reservationId);
    }
}
